using System;
using System.ComponentModel;
using MyUtils.Performance;

// ReSharper disable CheckNamespace

/// <summary>
/// Short cut for <see cref="ProfilingHelper"/>. Available in root namespace
/// </summary>
/// <example>
/// // Profiling is disabled by default
/// ProfilingHelper.EnableProfiling();
/// using (P.N)
/// {
/// 	Thread.Sleep(100);
/// }
/// using (P.S("test2"))
/// {
/// 	Thread.Sleep(200);
/// }
/// // Force show statistics (it is logged every 5 seconds, but you can force it to log)
/// Console.WriteLine(ProfilingHelper.GetLog());
/// 
/// // OUTPUT:
/// // --------------------
/// // 00:00:00.1970580         - test2
/// // 00:00:00.0966199         - Noname Sections
/// // Press any methodInfo to continue . . .
/// </example>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "P")]
public static class P
{
	/// <summary>
	/// Start noname profiling section
	/// </summary>
	[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "N")]
	public static IDisposable N
	{
		get { return ProfilingHelper.Default.Section("Noname Sections"); }
	}

	/// <summary>
	/// Get default profiling helper instance
	/// </summary>
	[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "D")]
	public static ProfilingHelperInstance D
	{
		get { return ProfilingHelper.Default; }
	}

	/// <summary>
	/// start named profiling section
	/// </summary>
	/// <param name="sectionName"></param>
	/// <returns></returns>
	[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "S")]
	public static IDisposable S(string sectionName)
	{
		return ProfilingHelper.Default.Section(sectionName);
	}

	/// <summary>Do not call this method.</summary>
	[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "b"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "a"), Obsolete("Do not call this method", true)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public new static bool Equals(object a, object b)
	{
		throw new InvalidOperationException("Do not call this method");
	}

	/// <summary>Do not call this method.</summary>
	[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "b"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "a"), Obsolete("Do not call this method", true)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public new static bool ReferenceEquals(object a, object b)
	{
		throw new InvalidOperationException("Do not call this method");
	}
}
